/*
 * 项目基础类
 * @author: huangzong
 */
import C from '@/common/common.js'

class Goods {
  /*
   * 打开基础设置页面
   */
  async openEditGoods (row) {
    return await C.openBrowserWindow('/editGoods', row, {
      transparent: true,
      frame: false,
      // openDevTools: true,
      width: 1200,
      height: 900,
      useSpa: false,
      spaModel: 'shop'
    })
  }

  /*
   * 编辑产品
   */
  async editGoods (data) {
    return await C.ajax('/shop/goods/editgoods', data, 'post')
  }

  /*
   * 新增自营商品
   */
  async openAddShopGoods (row) {
    return await C.openBrowserWindow('/openAddShopGoods', row, {
      transparent: true,
      frame: false,
      // openDevTools: true,
      width: 1200,
      height: 900,
      useSpa: false,
      spaModel: 'shop'
    })
  }

  /*
   * 打开产品分类
   */
  async openGoodsCategoryList (row) {
    return await C.openBrowserWindow('/openGoodsCategoryList', row, {
      transparent: true,
      frame: false,
      // openDevTools: true,
      width: 500,
      height: 645,
      useSpa: false,
      spaModel: 'shop'
    })
  }

  /*
   * 打开品牌分类
   */
  async openBrandList (row) {
    return await C.openBrowserWindow('/openBrandList', row, {
      transparent: true,
      frame: false,
      // openDevTools: true,
      width: 800,
      height: 645,
      useSpa: false,
      spaModel: 'shop'
    })
  }
}

export default new Goods()
